package com.blb.community_admin.util;

import cn.hutool.core.util.IdUtil;
import org.springframework.stereotype.Component;

@Component
public class UUIDUtils {

    /**
     * 生成唯一Id
     *
     * @return
     */
    public static long getId() {
        long id = IdUtil.getSnowflakeNextId();
        System.out.println("id = " + id);
        return id;
    }

    /**
     * 生成小区编码
     *
     * @return
     */
    public static String getCommunityCode() {
        long id = IdUtil.getSnowflakeNextId();
        String communityCode = "COMMUNITY_" + id;
        System.out.println("communityCode = " + communityCode);
        return communityCode;
    }

    /**
     * 生成房间编码
     *
     * @return
     */
    public static String getRoomCode() {
        long id = IdUtil.getSnowflakeNextId();
        String communityCode = "ROOM_" + id;
        System.out.println("roomCode = " + communityCode);
        return communityCode;
    }

    /**
     * 生成楼栋编码
     *
     * @return
     */
    public static String getBuildingCode() {
        long id = IdUtil.getSnowflakeNextId();
        String communityCode = "BUILDING_" + id;
        System.out.println("roomCode = " + communityCode);
        return communityCode;
    }
}
